/*
 * @Author: yxfan
 * @Date: 2023-11-04 15:54:30
 * @LastEditTime: 2023-11-04 16:19:03
 * @FilePath: /umi-demo/src/pages/test/useContext/index.jsx
 * @Description:
 */
import { useState } from 'react';
import Son1 from './components/Son1';
import Son2 from './components/Son2';
import MyContext from './context';

export default () => {
    const [value, setValue] = useState({ name: 'yxfan' });
    function change() {
        setValue({ name: 'cheneys' });
    }
    return (
        <MyContext.Provider value={value}>
            <div>
                父节点 <button onClick={change}>setValue</button>
                <Son1 />
                <Son2 />
            </div>
        </MyContext.Provider>
    );
};
